# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Jingbei Li <i@jingbei.li>
# Contributor: Jose Riha <jose1711 gmail com>

pkgname=python-pooch
_pyname=pooch
pkgver=1.8.0
pkgrel=1
pkgdesc='Python library for fetching and caching data files'
arch=(any)
url='https://www.fatiando.org/pooch/latest/'
license=(BSD)
depends=(python
         python-packaging
         python-platformdirs
         python-requests)
optdepends=('python-paramiko: for SFTP downloads'
            'python-tqdm: for printing a download progress bar')
makedepends=(python-build
             python-installer
             python-setuptools-scm
             python-wheel)
checkdepends=(python-pytest
              python-pytest-httpserver)
source=(https://pypi.python.org/packages/source/${_pyname:0:1}/$_pyname/$_pyname-$pkgver.tar.gz)
sha256sums=('f59981fd5b9b5d032dcde8f4a11eaa492c2ac6343fae3596a2fdae35fc54b0a0')

build() {
  cd $_pyname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_pyname-$pkgver
  pytest -v -k 'not test_check_availability_on_ftp and not test_ftp_downloader'
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
